#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
#include <linux/limits.h>
#include <linux/string.h>
#include <linux/file.h>
#include <linux/fs.h>
#include <linux/net.h>
#if defined(TK4) || defined(TK4_NEW)
#include <linux/genhd.h>
#else
#include <linux/blkdev.h>
#endif
#include <net/sock.h> #include <target/target_core_base.h>
#include "kprobe_prehook.h"
#include "syms.h"
#include "./include/kernel/sched/sched.h"
#include "./include/drivers/target/target_core_file.h"
#include "./include/drivers/block/loop.h"

#define shm_file_data(file) (*((struct shm_file_data **)&(file)->private_data))
extern unsigned int sysctl_module_debug;
extern unsigned int sysctl_module_print;
extern char printk_name_first[NAME_MAX];
extern char printk_name_last[NAME_MAX];
void print_info(void *opt, void *opt2, void *opt3)
{
	bool ret;

	if (sysctl_module_debug != 2 || sysctl_module_print == 0)
		return;

	ret = print_func_name(opt, opt2, opt3, printk_name_first, printk_name_last);
	if (ret)
		goto out;

	/***************** fs *****************/
	if (strstr(printk_name_first, "file->f_path.dentry->d_iname")) {
		struct file *file = (struct file *)opt;
		sprintf(printk_name_last, "%s\0", file->f_path.dentry->d_iname);
		ret = true;
	}
#ifndef TK3
	if (strstr(printk_name_first, "info->si_signo")) {
		struct kernel_siginfo *info = (struct kernel_siginfo *)opt2;
		/* demo:print signo */
		if (info > SEND_SIG_PRIV)
			sprintf(printk_name_last, "%d\0", info->si_signo);
		ret = true;
	}
#endif

out:
	if (ret && sysctl_module_print > 1)
		pr_info("%s, proc:%s, %d", printk_name_last, current->comm, current->pid);
}
